<!--
 * @Author: your name
 * @Date: 2022-03-21 10:53:01
 * @LastEditTime: 2022-03-21 11:23:21
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \算法测试\day0906\call,apply.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let obj = {
            name: "123",
            say: function () {
                console.log(this.name);
            }
        }
        let obj2 = {
            name: 'jiangp'
        }
        var name = "1234";
        //let age = "435345"
        obj.say.call(obj2);
        //console.log(window);

        // let len = 10;
        // function fn() {
        //     console.info(this.len)
        // }
        // fn(); //undefined
        // let Person = {
        //     len: 5,
        //     say: function () {
        //         fn();//undefined
        //         arguments[0]();//undefined
        //     }
        // }
        // Person.say(fn);

        var length = 10;
        function fn(a) {
            console.info(this.length)
        }
        fn('12');  // 10
        let Person = {
            length: 5,
            say: function () {
                fn();  // 10
                arguments[1]();  // 1
                console.log(arguments[0]);
            }
        }
        Person.say(fn,function(){});
        let arr = [fn]
        fn()

        console.log({a:1,b:2})
        console.info({a:1,b:2})
    </script>
</body>

</html>